﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caifu.Datas;

namespace Caifu.Clients
{
    public class SsoClient
    {
        public static readonly SsoClient Instance = new SsoClient();

        /// <summary>
        /// 根据Ticket（票据）获得相关单点登录信息
        /// </summary>
        /// <param name="ticket">票据</param>
        /// <returns></returns>
        public UserSso GetLoginInfoByTicket(Guid ticket)
        {
            return SsoData.Instance.GetLoginInfoByTicket(ticket);
        }


        /// <summary>
        /// 根据用户ID返回其单点登录信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>单点登录信息</returns>
        public UserSso GetLoginInfoByUserId(Guid userId)
        {
            return SsoData.Instance.GetLoginInfoByUserId(userId);
        }

        /// <summary>
        /// 添加单点登录信息
        /// <param name="loginInfo">
        /// 单点登录对象
        /// </param>
        /// </summary>
        public void AddSsoInfo(Guid uid, Guid ticket)
        {
            SsoData.Instance.AddSsoInfo(uid, ticket);
        }

         /// <summary>
        /// 更新单点登录信息
        /// <param name="loginInfo">
        /// 单点登录对象
        /// </param>
        /// </summary>
        public void UpdateSsoInfo(Guid uid, Guid ticket)
        {
            SsoData.Instance.UpdateSsoInfo(uid, ticket);
        }
    }
}
